Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update tailwind to version 4.0.0 #5990

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

leifmetcalf
Copy link
Contributor

This is waiting on the elixir library being updated to support tailwind v4 in phoenixframework/tailwind#103.

Things I'm not sure about:

  • Where the heroicons library should live. For the meantime I've put it in assets/css/tailwind_heroicons.js, but I'm not sure about the name and I don't think it belongs in assets/css. Also, for now, the tailwind standalone cli doesn't bundle the javascript library, so the heroicons plugin fails to load without running npm install tailwindcss or similar. See [v4] Standalone cli doesn't bundle tailwindcss js library tailwindlabs/tailwindcss#15235.

@SteffenDE
Copy link
Contributor

@Flo0807 mentioned in the related issue that the plugin works if it is directly exported as function: phoenixframework/tailwind#107 (comment)

I verified that it works, but I'm hesitant to rely on this. v4 doesn't really document how plugins should look like so that could change. I think if we wait for tailwindlabs/tailwindcss#15934, we should be good!

@leifmetcalf leifmetcalf force-pushed the tailwind-v4 branch 2 times, most recently from 51b9450 to 59e1743 Compare February 4, 2025 01:01
Comment on lines +7 to +9
@variant phx-click-loading ([".phx-click-loading&", ".phx-click-loading &"]);
@variant phx-submit-loading ([".phx-submit-loading&", ".phx-submit-loading &"]);
@variant phx-change-loading ([".phx-change-loading&", ".phx-change-loading &"]);
Copy link

@jotaviobiondo jotaviobiondo Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried the variants this way and it was not working, it should be:

Suggested change
@variant phx-click-loading ([".phx-click-loading&", ".phx-click-loading &"]);
@variant phx-submit-loading ([".phx-submit-loading&", ".phx-submit-loading &"]);
@variant phx-change-loading ([".phx-change-loading&", ".phx-change-loading &"]);
@custom-variant phx-click-loading (.phx-click-loading&, .phx-click-loading &);
@custom-variant phx-submit-loading (.phx-submit-loading&, .phx-submit-loading &);
@custom-variant phx-change-loading (.phx-change-loading&, .phx-change-loading &);

Copy link
Contributor Author

@leifmetcalf leifmetcalf Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this! Looking at the updated tailwind docs, we might also want to use @custom-variant instead of @variant? https://tailwindcss.com/docs/functions-and-directives#variant-directive

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants